package top.hkyzf.study.leetcode.array;

import org.junit.Test;

/**
 * @author 朱峰
 * @date 2022-2-20 20:40
 */
public class _1比特与2比特字符_717 {
    public boolean isOneBitCharacter(int[] bits) {
        int count = 0;
        for (int i = bits.length - 2; i >= 0; i--) {
            if (bits[i] == 1) {
                count++;
            } else {
                break;
            }
        }
        return count % 2 == 0;
    }

    @Test
    public void testIsOneBitCharacter () {
        int[] bits = {1,0,0};
        System.out.println(isOneBitCharacter(bits));
    }
}
